package com.banksoft.cps.controller.admin;

import com.banksoft.cps.bean.PoliceCheckTableOne;
import com.banksoft.cps.bean.warpper.PoliceCheckTableOneWrapper;
import com.banksoft.cps.controller.ControllerConstants;
import com.banksoft.cps.service.PoliceCheckTableOneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by rongzhao.zhu on 2018/11/21.
 */
@Controller
@RequestMapping("/admin/policeCheckTableOne/")
public class AdminPoliceCheckTableOneController extends ControllerConstants {
    @Autowired
    PoliceCheckTableOneService policeCheckTableOneService;
    @RequestMapping(value = "find",produces = "application/json;charset=utf-8")
    @ResponseBody
    public String find(String id){
        PoliceCheckTableOneWrapper bean = policeCheckTableOneService.findWrapperById(id);
        return toJSONString(createDataTip(bean));
    }
    @RequestMapping(value = "save", produces = "application/json;charset=utf-8")
    @ResponseBody
    public String save(PoliceCheckTableOne bean, HttpServletRequest request){
        try {
            policeCheckTableOneService.save(bean);
            return toJSONString(SUCCESS);
        } catch (Exception e) {
            e.printStackTrace();
            return toExceptionString(e);
        }
    }
}
